package top.infopub.mgr.sts.service.impl;

import java.math.BigDecimal;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import top.infopub.generic.GenericDao;
import top.infopub.generic.GenericServiceImpl;
import top.infopub.mgr.sts.dao.ProInvestPoolDao;
import top.infopub.mgr.sts.service.ProInvestPoolService;
import top.infopub.model.sts.ProInvestPool;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Maps;

@Service
public class ProInvestPoolServiceImpl extends GenericServiceImpl<ProInvestPool, String> implements
		ProInvestPoolService {

	@Autowired
	private ProInvestPoolDao proInvestPoolDao;
	
	@Override
	public GenericDao<ProInvestPool, String> getDao() {
		return proInvestPoolDao;
	}

    @Override
    public Page<ProInvestPool> selectQaDataByWhere(Page<ProInvestPool> page, String proCode) {
        Map<String, Object> where = Maps.newHashMap();
        where.put("proCode", proCode);
        where.put("orderCondition", "STS_MONTH desc");
        PageHelper.startPage(page.getPageNum(), page.getPageSize());
        return (Page<ProInvestPool>)proInvestPoolDao.selectByMapWhere(where);
    }

    @Override
    public BigDecimal selectTotalInvestAmount(String proCode) {
        return proInvestPoolDao.selectTotalInvestAmount(proCode);
    }

}